<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <router-link :to="{'name':'aaa'}">com_a</router-link>
    <router-link :to="{'name':'bbb'}">com_b</router-link>
    <router-link :to="{'name':'ccc'}">com_c</router-link>
    <hr/>
    <router-view></router-view>
</div>
</body>
</html>
<script src="../js/vue.min.js"></script>
<script src="../js/vue-router.js"></script>
<script>
    let com_a = {
        template: `
            <div>
                <h3>我是组件com_a</h3>
            </div>
        `
    }
    let com_b = {
        template: `
            <div>
                <h3>我是组件com_b</h3>
            </div>
        `
    }
    let com_c = {
        template: `
            <div>
                <h3>我是组件com_c</h3>
            </div>
        `
    }

    let router = new VueRouter({
        routes: [
            {
                path: '/aaa1',
                name: 'aaa',
                component: com_a
            },
            {
                path: '/bbb2',
                name: 'bbb',
                component: com_b
            },
            {
                path: '/ccc2',
                name: 'ccc',
                component: com_c
            }
        ]
    })

    new Vue({
        el: '#app',
        data() {
            return {}
        },
        components: {
            com_a, com_b, com_c
        },
        router: router
    })
</script>